# coding:utf8

import autoit

"""
pip install pygetwindow ==0.0.9
https://blog.csdn.net/weixin_44634704/article/details/129861909o

# install

pip install uiautomation
pip install win32gui


"""
from log import logger
import pygetwindow as gw
from time import sleep

windows = gw.getAllWindows()
for win in windows:
    logger.debug(win)
    
    
title = "记事本"
win = gw.getWindowsWithTitle(title)[0]
print(win)


# 大小和位置
title = "记事本"
win = gw.getWindowsWithTitle(title)[0]
print(win.left, win.top, win.width, win.height)


# move and adjust windows
win = gw.getWindowsWithTitle(title)[0]


def test_move():
    win.restore()
    sleep(2)
    win.moveTo(0, 0)
    sleep(2)
    win.minimize()
    sleep(2)
    win.maximize()
    sleep(2)
    win.restore()


win.activate()
logger.debug("win assert activate {}".format(win.isActive))

win.type('123+456')
sleep(1)
win.mouseClick(button='left', x=50, y=50)



